#include<iostream>
#include<string>
using namespace std;
typedef long long LL;
LL ans1;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		int l, r, x;
		int idx1 = l;
		int idx2 = r;
		int ans = 0;
		if (!x) {
			if (l & 1) {
				idx1 += 1;
			}
			if (r & 1) {
				idx2 -= 1;
			}
			if (idx1 <= idx2) {
				ans = idx2 - idx1 >> 1;
				ans1 = (idx1 + idx2) * ans / 2;
			}
		}
		else {
			if (idx1 <= idx2) {
				ans = idx2 - idx1 >> 1;
				ans1 = (idx1 + idx2) * ans / 2;
			}
		}
		cout << ans1 << endl;
	}
	return 0;
}